﻿using System.ComponentModel.Design;
using BenjaminSchroeter.DslTools;
using Microsoft.VisualStudio.Modeling.Shell;

namespace BenjaminSchroeter.CanDelete
{
    partial class CanDeleteExplorer
    {
        protected override void ProcessOnStatusDeleteCommand(System.ComponentModel.Design.MenuCommand cmd)
        {
            OnStatusDeleteCommandLogic.ForExplorerDelete(cmd, this.SelectedElement, base.ProcessOnStatusDeleteCommand);
        }

        protected override void ProcessOnStatusDeleteAllCommand(System.ComponentModel.Design.MenuCommand cmd)
        {
            OnStatusDeleteCommandLogic.ForExplorerDeleteAll(cmd,this.ObjectModelBrowser.SelectedNode,base.ProcessOnStatusDeleteAllCommand);
        }

        public override void AddCommandHandlers(IMenuCommandService menuCommandService)
        {
            base.AddCommandHandlers(menuCommandService);

            MenuCommand deleteAllCommand = menuCommandService.FindCommand(CommonModelingCommands.ModelExplorerDeleteAll);
            this.ObjectModelBrowser.AfterSelect += delegate{ ProcessOnStatusDeleteAllCommand(deleteAllCommand); };
        }
    }
}
